<?php
include_once("ConnectionManager.php");
/*------------------------------------------------------------CATEGORIES------------------------------------------------------------*/
//Get root category (no parent)
function getHotline(){
    $query = "SELECT * FROM MITI_HOTLINE";
    ConnectionManager::getInstance()->setQuery($query);
    $result = ConnectionManager::getInstance()->query();
    $row = mysql_fetch_array($result);
    return $row["CONTENT"];    
}

function updateHotline($content){
    $query = "SELECT COUNT(*) FROM MITI_HOTLINE";
    ConnectionManager::getInstance()->setQuery($query);
    $result = ConnectionManager::getInstance()->query();
    if(mysql_num_rows($result) == 0){
        $query = "INSERT INTO MITI_HOTLINE VALUES('$content')";
        ConnectionManager::getInstance()->setQuery($query);
        $finalR = ConnectionManager::getInstance()->query();
    }else{
        $query = "UPDATE MITI_HOTLINE SET CONTENT = '$content'";
        ConnectionManager::getInstance()->setQuery($query);
        $finalR = ConnectionManager::getInstance()->query();
    }
    return $finalR;
}
?>